<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>sfact</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : April 1993</div>
    <p>
      <b>sfact</b> -  discrete time spectral factorization</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>F=sfact(P)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>P</b>
        </tt>: real polynomial matrix</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
    Finds <tt>
        <b>F</b>
      </tt>, a spectral factor of
    <tt>
        <b>P</b>
      </tt>. <tt>
        <b>P</b>
      </tt> is a polynomial matrix such that
    each root of <tt>
        <b>P</b>
      </tt> has a mirror image w.r.t the unit
    circle. Problem is singular if a root is on the unit circle.</p>
    <p>
      <tt>
        <b>sfact(P)</b>
      </tt> returns a polynomial matrix
    <tt>
        <b>F(z)</b>
      </tt> which is antistable and such that</p>
    <p>
      <tt>
        <b>P = F(z)* F(1/z) *z^n</b>
      </tt>
    </p>
    <p>
    For scalar polynomials a specific algorithm is implemented.
    Algorithms are adapted from Kucera's book.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

//Simple polynomial example
z=poly(0,'z');
p=(z-1/2)*(2-z)
w=sfact(p);
w*numer(horner(w,1/z))
//matrix example
F1=[z-1/2,z+1/2,z^2+2;1,z,-z;z^3+2*z,z,1/2-z];
P=F1*gtild(F1,'d');  //P is symmetric
F=sfact(P)    
roots(det(P))  
roots(det(gtild(F,'d')))  //The stable roots
roots(det(F))             //The antistable roots
clean(P-F*gtild(F,'d'))
//Example of continuous time use
s=poly(0,'s');
p=-3*(s+(1+%i))*(s+(1-%i))*(s+0.5)*(s-0.5)*(s-(1+%i))*(s-(1-%i));p=real(p);
//p(s) = polynomial in s^2 , looks for stable f such that p=f(s)*f(-s) 
w=horner(p,(1-s)/(1+s));  // bilinear transform w=p((1-s)/(1+s))
wn=numer(w);              //take the numerator
fn=sfact(wn);f=numer(horner(fn,(1-s)/(s+1))); //Factor and back transform
f=f/sqrt(horner(f*gtild(f,'c'),0));f=f*sqrt(horner(p,0));      //normalization
roots(f)    //f is stable
clean(f*gtild(f,'c')-p)    //f(s)*f(-s) is p(s) 
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="../robust/gtild.htm">
        <tt>
          <b>gtild</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../robust/fspecg.htm">
        <tt>
          <b>fspecg</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
